package com.zzw.hj94;

import java.util.LinkedHashMap;
import java.util.Scanner;

/**
 * @Project: hw_java
 * @Description: 计票统计
 * @Author: zzw
 */

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        LinkedHashMap<String, Integer> map = new LinkedHashMap<>();
        // 初始化计数器
        for (int i = 0; i < n; i++) {
            map.put(in.next(), 0);
        }
        map.put("Invalid", 0);
        int num = in.nextInt();
        for (int i = 0; i < num; i++) {
            String s = in.next();
            if (map.containsKey(s)) {
                map.put(s, map.get(s) + 1);
            } else {
                map.put("Invalid", map.get("Invalid") + 1);
            }
        }
        map.forEach((k, v) -> System.out.println(k + " : " + v));
    }
}